/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package com.ruoyi.pingan.fymodule.busManage.busSubAcctBinding.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.ruoyi.pingan.annotation.CommonLog;
import com.ruoyi.pingan.fymodule.busManage.busSubAcctBinding.entity.busSubAcctBinding;
import com.ruoyi.pingan.fymodule.busManage.busSubAcctBinding.param.*;
import com.ruoyi.pingan.fymodule.busManage.busSubAcctBinding.service.BusSubAcctBindingService;
import com.ruoyi.pingan.fymodule.thirdpa.util.CommonResult;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


import javax.validation.Valid;
import java.util.List;

/**
 * 商户子账户绑定控制器
 *
 * @author zjf
 * @date  2025/07/10 13:50
 */
@Tag(name = "商户子账户绑定控制器")
@RestController
@Validated
public class busSubAcctBindingController {

    @Resource
    private BusSubAcctBindingService busSubAcctBindingService;

    /**
     * 获取商户子账户绑定分页
     *
     * @author zjf
     * @date  2025/07/10 13:50
     */
    @Operation(summary = "获取商户子账户绑定分页")
    @SaCheckPermission("/biz/busSubAcctBinding/page")
    @GetMapping("/biz/busSubAcctBinding/page")
    public CommonResult<Page<busSubAcctBinding>> page(busSubAcctBindingPageParam busSubAcctBindingPageParam) {
        return CommonResult.data(busSubAcctBindingService.page(busSubAcctBindingPageParam));
    }


    /**
     * 解绑
     */
    @Operation(summary = "商户子账户解绑")
    @CommonLog("商户子账户解绑")
    @SaCheckPermission("/biz/busSubAcctBinding/unbind")
    @PostMapping("/biz/busSubAcctBinding/unbind")
    public CommonResult<String> unbind(@RequestBody @Valid busSubAcctBindingUnbindParam busSubAcctBindingUnbindParam) {
        return busSubAcctBindingService.unbind(busSubAcctBindingUnbindParam);

    }


    /**
     * 提现账户联行号
     *
     * @author zjf
     * @date  2025/07/23 11:25
     */
    @Operation(summary = "提现账户联行号")
    @CommonLog("提现账户联行号")
    @SaCheckPermission("/biz/busSubAcctBinding/withdrawalaccount")
    @PostMapping("/biz/busSubAcctBinding/withdrawalaccount")
    public CommonResult<String> withdrawalaccount(@RequestBody @Valid busSubAcctBindingWithdrawalAccountParam busSubAcctBindingWithdrawalAccountParam) {
        busSubAcctBindingService.withdrawalaccount(busSubAcctBindingWithdrawalAccountParam);
        return CommonResult.ok();
    }

//    /**
//     * 绑定查询
//     */
//    @Operation(summary = "绑定查询")
//    @CommonLog("绑定查询")
//    @SaCheckPermission("/biz/busSubAcctBinding/bindquery")
//    @PostMapping("/biz/busSubAcctBinding/bindquery")
//    public CommonResult<MemberBindTranItemArrayVo> bindquery(@RequestBody @Valid busSubAcctBindingbindQueryParam busSubAcctBindingbindQueryParam) {
//        return CommonResult.data(busSubAcctBindingService.bindquery(busSubAcctBindingbindQueryParam));
//    }


    /**
     * 添加商户子账户绑定
     *
     * @author zjf
     * @date  2025/07/10 13:50
     */
    @Operation(summary = "添加商户子账户绑定")
    @CommonLog("添加商户子账户绑定")
    @SaCheckPermission("/biz/busSubAcctBinding/add")
    @PostMapping("/biz/busSubAcctBinding/add")
    public CommonResult<String> add(@RequestBody @Valid busSubAcctBindingAddParam busSubAcctBindingAddParam) {
        busSubAcctBindingService.add(busSubAcctBindingAddParam);
        return CommonResult.ok();
    }

    /**
     * 编辑商户子账户绑定
     *
     * @author zjf
     * @date  2025/07/10 13:50
     */
    @Operation(summary = "编辑商户子账户绑定")
    @CommonLog("编辑商户子账户绑定")
    @SaCheckPermission("/biz/busSubAcctBinding/edit")
    @PostMapping("/biz/busSubAcctBinding/edit")
    public CommonResult<String> edit(@RequestBody @Valid busSubAcctBindingEditParam busSubAcctBindingEditParam) {
        busSubAcctBindingService.edit(busSubAcctBindingEditParam);
        return CommonResult.ok();
    }




    /**
     * 删除商户子账户绑定
     *
     * @author zjf
     * @date  2025/07/10 13:50
     */
    @Operation(summary = "删除商户子账户绑定")
    @CommonLog("删除商户子账户绑定")
    @SaCheckPermission("/biz/busSubAcctBinding/delete")
    @PostMapping("/biz/busSubAcctBinding/delete")
    public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
                                                   List<busSubAcctBindingIdParam> busSubAcctBindingIdParamList) {
        busSubAcctBindingService.delete(busSubAcctBindingIdParamList);
        return CommonResult.ok();
    }

    /**
     * 获取商户子账户绑定详情
     *
     * @author zjf
     * @date  2025/07/10 13:50
     */
    @Operation(summary = "获取商户子账户绑定详情")
    @SaCheckPermission("/biz/busSubAcctBinding/detail")
    @GetMapping("/biz/busSubAcctBinding/detail")
    public CommonResult<busSubAcctBinding> detail(@Valid busSubAcctBindingIdParam busSubAcctBindingIdParam) {
        return CommonResult.data(busSubAcctBindingService.detail(busSubAcctBindingIdParam));
    }


}
